package com.hnn.learn.dubboconsumer;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.hnn.learn.api.ProvideService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

@ComponentScan("com.hnn.learn.*")
@EnableScheduling
@SpringBootApplication
public class DubboConsumerApplication {

	public static void main(String[] args) {
		SpringApplication.run(DubboConsumerApplication.class, args);

		//1、application
//		ApplicationConfig applicationConfig=new ApplicationConfig("sample-consumer");
//		//2、配置reference
//		ReferenceConfig referenceConfig=new ReferenceConfig();
//		referenceConfig.setApplication(applicationConfig);
//		referenceConfig.setInterface(ProvideService.class);
//		referenceConfig.setUrl("dubbo://192.168.20.21:20880/com.hnn.learn.api.ProvideService?anyhost=true&application=provider&bean.name=com.hnn.learn.api.ProvideService&bind.ip=192.168.20.21&bind.port=20880&dubbo=2.0.2&generic=false&interface=com.hnn.learn.api.ProvideService&methods=sayHello&owner=hnn&pid=21040&qos.accept.foreign.ip=false&qos.enable=true&qos.port=55555&side=provider&timestamp=1698374873212");
//		ProvideService userService = (ProvideService) referenceConfig.get();

//		ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("classpath:META-INF/spring/dubbo_consumer.xml");
//
//		System.out.println(context.getBean("ps",ProvideService.class).sayHello("sss"));
	}

}
